home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_32462.txt < prev    next >
Text File  |  1991-02-27  |  851b  |  27 lines

  1. -- card: 32462 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. For example, consider the alternate square() function, with no return value:
  11.  
  12.     void  square(float *f_ptr)
  13.     {
  14.         *f_ptr = (*f_ptr) * (*f_ptr);
  15.     }
  16.  
  17. This function may be called from another function as:
  18.  
  19.     square(&the_value);
  20.  
  21. The value contained in the variable the_value is thus squared.
  22.  
  23. This technique is also used when passing an array to a function, since the array name is treated as a pointer to the zeroth element of the array.  To pass this pointer as an argument, the array identifier is given without brackets.  An example is the following function which squares each element of an array containing 3 elements.
  24.  
  25. -- part contents for background part 7
  26. ----- text -----
  27. 90